<template>
	<div>
		<x-header style="background: #e78a3d; color: #fff;" :left-options="{backText: ''}" :right-options="{showMore: false}" @on-click-more="showMenus = true">{{seller.mchtName}}</x-header>
		<div class="home-wrapper" ref="homeWrapper">
			<deskmsg :seller="seller"></deskmsg>
		    <div class="tab border-1px" ref="tabbox">
		      <div class="tab-item" @click="goGoods()" :class="{'active':showGoods}">
		      	点单
		      </div>
		      <div class="tab-item" @click="goRatings()" :class="{'active':!showGoods}">
		      	购物车
		      </div>
		    </div>
	    </div>
	    <goods v-show='goodsshow' ref="goods"></goods>
	    <ratings v-show='!goodsshow' ref="ratings"></ratings>
	    <shopcart :seller="seller" ref="shopcart"></shopcart>
	</div>
</template>

<script type="text/ecmascript-6">
  import BScroll from 'better-scroll';
  import { XHeader } from 'vux'
  import shopcart from 'components/shopcart/shopcart';
  import goods from 'components/goods/goods';
  import ratings from 'components/ratings/ratings';
  import deskmsg from 'components/deskmsg/deskmsg';
  import {getMchtId} from 'src/methods/request.js'
  const ERR_OK = 0;
  const debug = process.env.NODE_ENV !== 'production';

  export default {
    props: {
    },
    data() {
      return {
        showGoods:true,
        goodsshow:true,
        mchtId:"",
        seller: {
        },
      };
    },
    computed: {
    	
    },
    created() {
    	this.mchtId = sessionStorage.getItem("mchtId")
			//获取商户信息
	    getMchtId({mchtId:10000094}).then(
				response => {
					this.seller = Object.assign({}, response.data);
				}
		).catch(
			error => console.log(error)
		);
    },
    methods: {
      goGoods(){
      	this.showGoods = true;
      	this.goodsshow = true;
      },
      goRatings(){
      	this.showGoods = false;
      	this.goodsshow = false;
      	this.$nextTick(() => {
	        this.$refs.ratings._initScroll();;
	    });
      }
    },
    mounted () {  
	  },  
    components: {
      deskmsg,goods,shopcart,ratings,XHeader
    }
  };
</script>

<style>
	.tab{
		position: absolute;
	}
</style>